/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Performance.java
 *
 * Created on 19 Μαϊ 2011, 7:11:52 μμ
 */

package tools.options.panels;

import java.util.Hashtable;
import javax.swing.JLabel;
import myseriesproject.MySeries;
import tools.options.IMySeriesOptions;

/**
 *
 * @author lordovol
 */
public class Performance extends javax.swing.JPanel implements IMySeriesOptions {

    /** Creates new form Performance */
    public Performance() {
        initComponents();
        addSliderLabels();
    }

     private void addSliderLabels() {
        Hashtable<Integer,JLabel> labelTable = new Hashtable();
        labelTable.put( new Integer( 0 ), new JLabel("0") );
        labelTable.put( new Integer( 5000 ), new JLabel("5000") );
        labelTable.put( new Integer( 10000 ), new JLabel("10000") );
        sl_memory.setLabelTable(labelTable);
        sl_memory.setPaintLabels(true);
        labelTable = new Hashtable();
        labelTable.put( new Integer( 0 ), new JLabel("Low") );
        labelTable.put( new Integer( 1 ), new JLabel("Medium") );
        labelTable.put( new Integer( 2 ), new JLabel("Normal") );
        labelTable.put( new Integer( 3 ), new JLabel("High") );
        sl_image.setLabelTable(labelTable);
        sl_image.setPaintLabels(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        jLabel17 = new javax.swing.JLabel();
        cb_autoUnzip = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        sl_memory = new javax.swing.JSlider();
        sl_image = new javax.swing.JSlider();
        jLabel25 = new javax.swing.JLabel();
        cb_moveVideoFiles = new javax.swing.JCheckBox();
        cb_autoUnzip1 = new javax.swing.JCheckBox();

        setName("Performance"); // NOI18N

        jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel17.setText("Auto update Files :");
        jLabel17.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

        cb_autoUnzip.setSelected(MySeries.options.getBooleanOption(HIDE_DELETED_SERIES_RATINGS));
        cb_autoUnzip.setText("Hide deleted series ratings");
        cb_autoUnzip.setName(HIDE_DELETED_SERIES_RATINGS);
        cb_autoUnzip.setOpaque(false);

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, sl_memory, org.jdesktop.beansbinding.ELProperty.create("Update memory indicator every ${value} ms"), jLabel1, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        sl_memory.setMajorTickSpacing(1000);
        sl_memory.setMaximum(10000);
        sl_memory.setMinorTickSpacing(200);
        sl_memory.setPaintTicks(true);
        sl_memory.setSnapToTicks(true);
        sl_memory.setToolTipText("Frequency of memory consumption update");
        sl_memory.setValue(MySeries.options.getIntegerOption(MEMORY_CONSUMPTION_UPDATE));
        sl_memory.setName(MEMORY_CONSUMPTION_UPDATE);
        sl_memory.setOpaque(false);

        sl_image.setMajorTickSpacing(1);
        sl_image.setMaximum(3);
        sl_image.setMinorTickSpacing(1);
        sl_image.setPaintTicks(true);
        sl_image.setSnapToTicks(true);
        sl_image.setValue(MySeries.options.getIntegerOption(IMAGE_QUALITY));
        sl_image.setName(IMAGE_QUALITY);
        sl_image.setOpaque(false);

        jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel25.setText("Screenshots quality");

        cb_moveVideoFiles.setFont(cb_moveVideoFiles.getFont().deriveFont((cb_moveVideoFiles.getFont().getStyle() | java.awt.Font.ITALIC), cb_moveVideoFiles.getFont().getSize()-1));
        cb_moveVideoFiles.setSelected(MySeries.options.getBooleanOption(MOVE_VIDEO_FILES));
        cb_moveVideoFiles.setText("Move avi files from series main directory");
        cb_moveVideoFiles.setName(MOVE_VIDEO_FILES);
        cb_moveVideoFiles.setOpaque(false);
        cb_moveVideoFiles.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_moveVideoFilesActionPerformed(evt);
            }
        });

        cb_autoUnzip1.setFont(cb_autoUnzip1.getFont().deriveFont((cb_autoUnzip1.getFont().getStyle() | java.awt.Font.ITALIC), cb_autoUnzip1.getFont().getSize()-1));
        cb_autoUnzip1.setSelected(MySeries.options.getBooleanOption(AUTO_EXTRACT_ZIPS));
        cb_autoUnzip1.setText("Move , extract subtitles in zip files and delete the zip");
        cb_autoUnzip1.setName(AUTO_EXTRACT_ZIPS);
        cb_autoUnzip1.setOpaque(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(cb_autoUnzip, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addComponent(cb_moveVideoFiles, javax.swing.GroupLayout.DEFAULT_SIZE, 391, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(sl_memory, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(sl_image, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(cb_autoUnzip1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sl_memory, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sl_image, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(cb_autoUnzip)
                .addGap(6, 6, 6)
                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cb_autoUnzip1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cb_moveVideoFiles)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents

  private void cb_moveVideoFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_moveVideoFilesActionPerformed
    // TODO add your handling code here:
  }//GEN-LAST:event_cb_moveVideoFilesActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox cb_autoUnzip;
    private javax.swing.JCheckBox cb_autoUnzip1;
    private javax.swing.JCheckBox cb_moveVideoFiles;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JSlider sl_image;
    private javax.swing.JSlider sl_memory;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

}
